package cn.buddha.jec.util;

import cn.buddha.jec.config.TongExceptionProperties;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName TongExceptionConfigUtils
 * @Author 友野浩二
 * @Date 2020/4/8 10:18
 * @Description 公共配置工具类
 * @Version 1.0
 */
@Slf4j
public class TongExceptionConfigUtils {

    /**
     * 业务逻辑处理之前公共处理的异常开关
     */
    public static Boolean tongExPreHandlerEnable = false;

    /**
     * 真正业务逻辑处理的异常开关
     */
    public static Boolean tongExMiddleHandlerEnable = false;

    /**
     * 业务逻辑处理之后公共处理的异常开关
     */
    public static Boolean tongExPostHandlerEnable = false;

    public static void setExEnable(TongExceptionProperties tongExceptionConfig) {
        log.info("tongExceptionConfig: {}", System.lineSeparator() + tongExceptionConfig);

        tongExPreHandlerEnable = tongExceptionConfig.getPreHandlerEnable();
        tongExMiddleHandlerEnable = tongExceptionConfig.getMiddleHandlerEnable();
        tongExPostHandlerEnable = tongExceptionConfig.getPostHandlerEnable();
    }

}
